<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *订单管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$return['status']=$this->renwuorder_status;
if($_RQ['op']=='list'){
	$return['params']=array('koufee >'=>0);
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if(isset($_RQ['status']) && $_RQ['status']!=100){
		$params['status']=intval($_RQ['status']);
		$return['params']['status']=intval($_RQ['status']);
	}
	if(!empty($_RQ['title'])){
		$params2=array('uniacid'=>$_SESSION['uniacid']);
		$params2['title like']='%'.trim($_RQ['title']).'%';
		$renwuids=pdo_getall('jy_renwushop_renwu',$params2,'id','id');
		if($renwuids){
			$renwuids=array_keys($renwuids);
			$params['renwuid']=$renwuid;
		}
		$return['params']['title']=$_RQ['title'];
	}
	if(isset($_RQ['mid'])){
		$params['mid']=intval($_RQ['mid']);
		$return['params']['mid']=intval($_RQ['mid']);
	}
	//我的团
	//先查询我的订单
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$list=pdo_getslice('jy_renwushop_renwuorder',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($list){
		foreach($list as $k=>&$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			//到期时间
			$renwu=pdo_get('jy_renwushop_renwu',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['renwuid']));
			$item['title']=$renwu['title'];
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'id','title'=>'ID','type'=>'string'),
			array('name'=>'member','title'=>'会员信息_Member','type'=>'member'),
			array('name'=>'title','title'=>'任务名称','type'=>'string'),
			array('name'=>'fee','title'=>'任务奖励','type'=>'string'),
			array('name'=>'koufee','title'=>'平台扣佣','type'=>'string'),
			array('name'=>'createtime','title'=>'时间','type'=>'time'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status'),
		),'action'=>array(
			//array('type'=>'href','action'=>'jy_weishop/order.detail/','title'=>'订单详情_Detail'),
		)
		),
		'search'=>array(
			array('name'=>'id','title'=>'ID','type'=>'string','width'=>15),
			array('name'=>'title','title'=>'任务名称','type'=>'string','width'=>15),
			array('type'=>'choose','width'=>15,'action'=>'core/member.get_member/','name'=>'mid','title'=>'选择会员'),
			array('name'=>'status','width'=>15,'title'=>'状态','type'=>'radio','options'=>'status'),
		)
	);
	$return['htmls']=$htmls;	
	exi($return);
}
